package servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 用servlet来模拟核心业务动作
 */
public class MyServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		// 1这里不用再设置编码和处理中文乱码问题，因为过滤器已经预设过了
		// 2这里只需要处理核心业务 
		PrintWriter out = response.getWriter();
		out.write("这里是Servlet的输出，Servlet工作中...模拟的是核心业务");
	
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
